import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'
import home from '@/views/home'
import Layout from '@/components/Layout'
import notfound from '@/views/404NotFound'


var asyncRoutes=[
  {
    path:'home',
    name:'home',
    component: home,
},
  {
    path:'about',
    name:'about',
    component:import('@/views/about')
  },
  {
    path:'user/roleManager',
    name:'roleManager',
    component:import('@/views/system/roleManager')
  },{
    path:'user/registerUser',
    name:'registerUser',
    component:import('@/views/system/manager')
  },{
    path:'user/menuManager',
    name:'menuManager',
    component:import('@/views/system/menuManager')
  }
]


const routes = [
  {
    path: '/',
    redirect:'/views/home',
    name: 'views',
    component: Layout,
    children:[
      // ...asyncRoutes
    ] 
  },
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/login')
  },
  {
    path: '/*',
    name: '404NotFound',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: notfound
  }


]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
